-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
THRIFT-4134-Fix-remaining-undefined-behavior-invalid.patch #1222
Conversation
@@ -15,7 +15,7 @@ export CXX=clang++-3.8 | |||
# undefined casting, aka "vptr". | |||
# | |||
# TODO: fix undefined vptr behavior and turn this option back on. | |||
export CFLAGS="-fsanitize=undefined -fno-sanitize-recover=undefined -fno-sanitize=vptr" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll still want to include -fno-sanitize-recover=undefined
, I think. When that option is set, a binary will crash on undefined behavior. When it is not set, the binary will print an error and continue.
Having it set is preferable, I think, so that undefined behavior causes the tests to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just used your proposal. Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should have been more explicit. For finding vptr
errors, it's good to remove -fno-sanitize-recover=undefined
. But for checking that there are none, it's good to have -fno-sanitize-recover=undefined
.
If this patch fixes some, but not all, of the vptr
errors, I would suggest leaving CFLAGS
as it is in master
. If it fixes all vptr
errors, I think the way you have it now is optimal.
t_type* etype = ((t_list*)ttype)->get_elem_type(); | ||
write_key_and_string("elemTypeId", get_type_name(etype)); | ||
write_type_spec_object("elemType", etype); | ||
} else if (ttype->is_set()) { | ||
t_type* etype = ((t_set*)ttype)->get_elem_type(); | ||
write_key_and_string("elemTypeId", get_type_name(etype)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: these lines are duplicated from above. They can be refactored by setting etype in a conditional and putting 282 and 283 below that.
t_type* etype = ((t_list*)ttype)->get_elem_type(); | ||
write_element_start("elemType"); | ||
write_type(etype); | ||
write_element_end(); | ||
} else if (type == "set") { | ||
t_type* etype = ((t_set*)ttype)->get_elem_type(); | ||
write_element_start("elemType"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: duplicate lines (see above)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know they are duplicates because I duplicated them. One could argue that it is more readable but sure, we can have a conditional. Or we could refactor it into a method and include the map case.
Mmmh. I think I go with the duplicates. Feel free to make it better. |
No, the intention is to patch everything. A few things are still open, but I will update the PR until we have it all. |
How about
Another alternative is to do what your other patch is doing and have |
To be honest, my intention is to fix the actual problem, not to refactor the whole app. |
No description provided.